using JSOCTNetSDK.XmppModelFun;
using jsxmpp;
using System;

namespace JSOCTNetSDK.XmppTask
{
	public class MyServiceResponseHandler : ServiceResponseHandler
	{
		public delegate void UploadResultHandler(ServiceResponseData Result);

		public event MyServiceResponseHandler.UploadResultHandler OnUploadResultHandler;

		public override void execute(string fromUser, ServiceResponseData responseData)
		{
			try
			{
				System.Console.WriteLine("上传返回: " + responseData.serviceId + " " + System.DateTime.Now.ToString());
				if (ConfigFile.IsPrintlog)
				{
					string json = ModelToJson.GetJson(responseData);
					string strMessage = string.Format("上传返回数据:{0} ", json);
					XmppLogHelper.LogSDKUpdateData.Info(strMessage);
				}
				base.execute(fromUser, responseData);
				if (responseData != null && responseData.serviceId.ToUpper().IndexOf("NISSP_ACION_EQUIPMENT_STATE") < 0 && responseData.serviceId.ToUpper().IndexOf("NISSP_PARK_SPACE") < 0 && this.OnUploadResultHandler != null)
				{
					this.OnUploadResultHandler(responseData);
				}
			}
			catch (System.Exception ex)
			{
				XmppLogHelper.LogSDK.Error(ex);
			}
		}
	}
}
